package com.orphan.marketBack.controller;

import com.orphan.marketBack.dto.OrderMaintenanceDto;
import com.orphan.marketBack.service.impl.OrderMaintenanceServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 订单维护
 */
@RestController
public class OrderMaintenanceController {
    @Autowired
    OrderMaintenanceServiceImpl orderMaintenanceService;

    /**
     * 展示所有订单
     * @return
     */
    @RequestMapping("selectOrderMaintenance")
    public List<OrderMaintenanceDto> OrderMaintenance(){
        List<OrderMaintenanceDto> orderMaintenanceDtos = orderMaintenanceService.selectOrderMaintenance();
        System.out.println("orderMaintenanceDtos 111111111111= " + orderMaintenanceDtos);
        return orderMaintenanceDtos;
    }

    /**
     * 根据商品名称查询订单
     * @param
     * @return
     */
    @PostMapping("selectOrderMaintenanceByGoodsName")
    public List<OrderMaintenanceDto> OrderMaintenanceByGoodsName(OrderMaintenanceDto orderMaintenanceDto){
        List<OrderMaintenanceDto> orderMaintenanceByGoodsName = orderMaintenanceService.selectOrderMaintenanceByGoodsName(orderMaintenanceDto);
        return orderMaintenanceByGoodsName;
    }
}
